<div id="detail">
  <div class="back">
    <button nz-button [nzType]="'primary'" (click)="goBack()">返回</button>
  </div>

  <!--项目信息-->
  <div class="info">
    <div class="info_title">项目信息
      <nz-tag [nzColor]="'green'" (click)="skipTo(0,'edit')">已配置</nz-tag>
    </div>
    <div nz-row>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6">项目名：</div>
        <div nz-col [nzSpan]="18">{{projectData.name}}</div>
      </div>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6">项目英文名：</div>
        <div nz-col [nzSpan]="18">{{projectData.englishName}}</div>
      </div>
    </div>
    <div nz-row>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6">数据库类型：</div>
        <div nz-col [nzSpan]="18">{{projectData.databaseType}}</div>
      </div>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6"> 项目版权信息：</div>
        <div nz-col [nzSpan]="18">{{projectData.copyright}}</div>
      </div>
    </div>
    <div nz-row>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6">作者：</div>
        <div nz-col [nzSpan]="18">{{projectData.author}}</div>
      </div>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6">作者联系方式：</div>
        <div nz-col [nzSpan]="18">{{projectData.phone}}</div>
      </div>
    </div>
    <div nz-row>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6">项目描述：</div>
        <div nz-col [nzSpan]="18">{{projectData.description}}</div>
      </div>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="6">SQL类型：</div>
        <div nz-col [nzSpan]="18">
          <nz-tag>{{projectData.databaseType}}</nz-tag>
        </div>
      </div>
    </div>
  </div>

  <!--SQL信息-->
  <div class="sql_info">
    <div class="info_title">SQL信息
      <nz-tag [nzColor]="projectData.projectSqlList?.length?'green':'red'"
              (click)="skipTo(1,this.projectData.projectSqlList?.length?'edit':'add')">
        {{projectData.projectSqlList?.length?'已配置':'待配置'}}
      </nz-tag>
    </div>
    <ngx-monaco-editor [options]="editorOptions" [(ngModel)]="code"></ngx-monaco-editor>
  </div>

  <!--数据管理-->
  <div class="technology_info">
    <div class="info_title">数据管理
      <nz-tag [nzColor]="projectData.projectFramworkList?.length?'green':'red'"
              (click)="skipTo(2,this.projectData.projectFramworkList?.length?'edit':'add')">
        {{projectData.projectFramworkList?.length?'已配置':'待配置'}}
      </nz-tag>
    </div>
    <div>开发中……</div>
  </div>

  <!--技术信息-->
  <div class="technology_info">
    <div class="info_title">技术信息
      <nz-tag [nzColor]="projectData.projectFramworkList?.length?'green':'red'"
              (click)="skipTo(3,this.projectData.projectFramworkList?.length?'edit':'add')">
        {{projectData.projectFramworkList?.length?'已配置':'待配置'}}
      </nz-tag>
    </div>
    <div nz-row *ngFor="let item of framslist;let i=index">
      <div nz-col [nzSpan]="2">
        <span *ngIf="i==0">所选技术：</span>
      </div>
      <div nz-col [nzSpan]="10">
        <nz-tag>{{item.frameworks?.name}}</nz-tag>
      </div>
      <div nz-col [nzSpan]="12">
        <span>{{item.frameworks?.description}}</span>
        <!--<nz-tag class="w100"></nz-tag>-->
      </div>
    </div>
  </div>

  <!--仓库信息-->
  <div class="warehouse_info">
    <div class="info_title">仓库信息
      <nz-tag [nzColor]="projectData.projectRepositoryAccountList?.length?'green':'red'"
              (click)="skipTo(4,this.projectData.projectRepositoryAccountList?.length?'edit':'add')">
        {{projectData.projectRepositoryAccountList?.length?'已配置':'待配置'}}
      </nz-tag>
    </div>
    <div nz-row>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="4">
          仓库类型：
        </div>
        <div nz-col [nzSpan]="20">
          {{repositoryInfo?.type}}
        </div>
      </div>
      <div nz-col [nzSpan]="12">
        <div nz-col [nzSpan]="4">
          仓库账号：
        </div>
        <div nz-col [nzSpan]="20">
          {{repositoryInfo?.account}}
        </div>
      </div>
    </div>
    <div nz-row>
      <div nz-col [nzSpan]="2">
        仓库地址：
      </div>
      <div nz-col [nzSpan]="22">
        <a [href]="repositoryInfo?.home" target="_blank" class="myLink" title="仓库地址">{{repositoryInfo?.home}}</a>
      </div>
    </div>
    <div nz-row>
      <div nz-col [nzSpan]="2">
        仓库描述：
      </div>
      <div nz-col [nzSpan]="22">
        {{repositoryInfo?.description}}
      </div>
    </div>
  </div>
  <div class="warehouse_info" *ngIf="jobList.length>0">
    <div class="info_title">下载项目</div>
    <div nz-row>
      <div nz-col [nzSpan]="24">
        <div nz-col [nzSpan]="2">
          项目源码：
        </div>
        <div nz-col [nzSpan]="2">
          <a href="{{projectData.downloadUrl}}" target="_blank" class="underline" title="下载源码">下载源码</a>
        </div>
        <div nz-col [nzSpan]="2">
          <a [routerLink]="'/main/project/source'" class="underline" title="查看源码"
             [queryParams]="{code:projectCode,filePath:projectData?.englishName}">查看源码</a>
        </div>
      </div>
    </div>
  </div>

  <!--构建历史-->
  <div class="history">
    <div class="info_title">构建历史</div>
    <nz-table #nzTable [nzData]="jobList" [nzPageSize]="10">
      <thead nz-thead>
      <tr>
        <th nz-th>
          <span>序号</span>
        </th>
        <th nz-th>
          <span>时间</span>
        </th>
        <th nz-th>
          <span>状态</span>
        </th>
        <th nz-th>
          <span>操作</span>
        </th>
      </tr>
      </thead>
      <tbody nz-tbody>
      <tr nz-tbody-tr *ngFor="let item of nzTable.data; let index = index">
        <td nz-td>{{index+1}}</td>
        <td nz-td>{{item.createTime}}</td>
        <td nz-td>
          <nz-badge [nzStatus]="'success'" *ngIf="item.state=='Completed'" [nzText]="item.state"></nz-badge>
          <nz-badge [nzStatus]="'error'" *ngIf="item.state=='Error'" [nzText]="item.state"></nz-badge>
          <nz-badge [nzStatus]="'warning'" *ngIf="item.state=='Waring'" [nzText]="item.state"></nz-badge>
          <nz-badge [nzStatus]="'processing'" *ngIf="item.state=='Create'" [nzText]="item.state"></nz-badge>
          <nz-badge [nzStatus]="'processing'" *ngIf="item.state=='Executing'" [nzText]="item.state"></nz-badge>
        </td>
        <td nz-td>
          <button nz-button [nzType]="'primary'" (click)=linkLogs(item.code,item.state)>
            <span>查看日志</span>
          </button>
        </td>
      </tr>
      </tbody>
    </nz-table>
  </div>
  <div class="creat_code">
    <button nz-button [nzSize]="'large'" [nzType]="'primary'" (click)="buildTask()">构建项目</button>
  </div>
</div>
